package com.xingceng.stock.controller;


import com.xiceng.stock.dto.LoginDTO;
import com.xiceng.stock.vo.CaptchaVO;
import com.xiceng.stock.vo.LoginVO;
import com.xingceng.stock.api.UserControllerAPI;
import com.xingceng.stock.response.ResponseResult;
import com.xingceng.stock.service.SysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zby
 * @created 2024-06-22 22:48
 * @description 用户接口实现
 */
@RestController
@RequiredArgsConstructor
public class UserController implements UserControllerAPI {

    private final SysUserService userService;

    @Override
    public String getName() {

        return "itheima";
    }

    @Override
    public ResponseResult<CaptchaVO> generateCaptcha() {
        return ResponseResult.ok(userService.generateCaptcha());
    }

    @Override
    public ResponseResult<LoginVO> login(LoginDTO dto) {
        return ResponseResult.ok(userService.login(dto));
    }
}